package com.h2210c.user.controller;

import com.github.pagehelper.PageInfo;
import com.h2210c.user.fenig.FeignCatalog;
import com.h2210c.user.fenig.FeignLabel;
import com.h2210c.user.fenig.ListCourseService;
import com.jiyun.model.Catalog;
import com.jiyun.model.Course;
import com.jiyun.model.Label;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("kecheng")
public class kechengController {
@Autowired
    ListCourseService listCourseService;
@Autowired
    FeignCatalog feignCatalog;
    @RequestMapping("/findPage")
    public PageInfo<Course> findPage(@RequestBody Course course){

        return listCourseService.findPage(course);
    }
    @RequestMapping("/catalogbycid")
    public List<Catalog> catalogbycid(@RequestParam("id") Integer id){
        return feignCatalog.catalogbycid(id);
    }

@Autowired
    FeignLabel feignLabel;
    @RequestMapping("/labellist")
    public List<Label> labellist(){
        return feignLabel.labellist();
    }
    @RequestMapping("/findbyid")
    public Course findbyid(@RequestParam("id") Integer id){
 return   listCourseService.findbyid(id);

    }
}
